package com.mall.b2c.bean;

import com.mall.b2c.domain.member.MemberDomain;
import com.mall.b2c.domain.member.SiteNoticeDomain;
import com.mall.b2c.domain.member.SiteNoticeTextDomain;
import com.mall.common.util.DateHelper;

import java.io.Serializable;

public class SiteNoticeBean implements Serializable {

	private Long id;
	private Long memberId;
	private String title;
	private Boolean isRead;
	private Boolean isDelete;
	private String createDate;
	private Boolean enabledOuterUrl; //启用外部链接
	private String outerUrl; // 外部链接
	
	private Long noticeTextId; //通知内容id
	private String content; //内容
	
	private String type;

	public SiteNoticeBean() {
	}
	
	public SiteNoticeBean(SiteNoticeDomain notice) {
		if(notice == null){
			return;
		}
		SiteNoticeTextDomain noticeText = notice.getNoticeText();
		if(noticeText != null){
			this.noticeTextId = noticeText.getId();
			this.title = noticeText.getTitle();
			this.content = noticeText.getContent();
			this.type = noticeText.getType().name();
			this.enabledOuterUrl = noticeText.getEnabledOuterUrl();
			this.outerUrl = noticeText.getOuterUrl();
			this.createDate = DateHelper.date2String(noticeText.getCreateDate(),"yyyy-MM-dd HH:mm:ss");
		}
		
		if(notice != null){
			this.id = notice.getId();
			MemberDomain member = notice.getMember();
			this.memberId = member == null ? null : member.getId();
			this.isDelete = notice.getIsDelete();
			this.isRead = notice.getIsRead();
		}
	}
	
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getNoticeTextId() {
		return noticeTextId;
	}

	public void setNoticeTextId(Long noticeTextId) {
		this.noticeTextId = noticeTextId;
	}

	public Long getMemberId() {
		return memberId;
	}

	public void setMemberId(Long memberId) {
		this.memberId = memberId;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Boolean getIsRead() {
		return isRead;
	}

	public void setIsRead(Boolean isRead) {
		this.isRead = isRead;
	}

	public Boolean getIsDelete() {
		return isDelete;
	}

	public void setIsDelete(Boolean isDelete) {
		this.isDelete = isDelete;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getCreateDate() {
		return createDate;
	}

	public void setCreateDate(String createDate) {
		this.createDate = createDate;
	}

	public Boolean getEnabledOuterUrl() {
		return enabledOuterUrl;
	}

	public void setEnabledOuterUrl(Boolean enabledOuterUrl) {
		this.enabledOuterUrl = enabledOuterUrl;
	}

	public String getOuterUrl() {
		return outerUrl;
	}

	public void setOuterUrl(String outerUrl) {
		this.outerUrl = outerUrl;
	}
	
}
